<div class="row">
    <div class="col-xs-12">
        <div class="box box-primary">
            <div class="box-header">
                <h3 class="box-title">单页列表</h3>

                <div class="box-tools">
                    <button class="btn btn-success btn-sm" data-url="{{ url('/admin/spa/create') }}" onclick="jumpfun(this)">创建单页</button>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
                <table class="table table-hover">
                    <tr>
                        <th>单页ID</th>
                        <th>单页名称</th>
                        <th>SKU</th>
                        <th>商品图片</th>
                        <th>销售国家</th>
                        <th>单页地址</th>
                        <th>创建时间</th>
                        <th>单页状态</th>
                        <th>操作</th>
                    </tr>
                    <tr>
                        <th>
                            <div class="box-tools">
                                <form class="form-horizontal">
                                    <div class="input-group input-group-sm" style="width: 100px;">
                                        @if(isset($id))
                                        <input id="sinput" type="text" name="id_search" class="form-control pull-right" value="{{$id}}">
                                        @else
                                        <input id="sinput" type="text" name="id_search" class="form-control pull-right">
                                        @endif
                                        <div class="input-group-btn">
                                            <button type="button" class="filter btn btn-primary" data-url="{{ url('admin/spa/lst') }}" data-type="get" style="margin-right: 10px" onclick="getfun(this)"><i class="fa fa-search"></i></button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </th>
                        <th></th>
                        <th>
                            <div class="box-tools">
                                <form class="form-horizontal">
                                    <div class="input-group input-group-sm" style="width: 150px;">
                                        @if(isset($sku))
                                        <input id="sinput" type="text" name="sku_search" class="form-control pull-right" value="{{$sku}}">
                                        @else
                                        <input id="sinput" type="text" name="sku_search" class="form-control pull-right">
                                        @endif
                                        <div class="input-group-btn">
                                            <button type="button" class="filter btn btn-primary" data-url="{{ url('admin/spa/lst') }}" data-type="get" style="margin-right: 10px" onclick="getfun(this)"><i class="fa fa-search"></i></button>
                                        </div>
                                    </div>
                                </form>
                            </div>                        
                        </th>
                        <th></th>
                        <th>
                            <div class="box-tools">
                                <form class="form-horizontal">
                                    <div class="input-group input-group-sm" style="width: 100px;">
                                        @if(isset($country))
                                        <input id="sinput" type="text" name="country_search" class="form-control pull-right" value="{{$country}}">
                                        @else
                                        <input id="sinput" type="text" name="country_search" class="form-control pull-right">
                                        @endif
                                        <div class="input-group-btn">
                                            <button type="button" class="filter btn btn-primary" data-url="{{ url('admin/spa/lst') }}" data-type="get" style="margin-right: 10px" onclick="getfun(this)"><i class="fa fa-search"></i></button>
                                        </div>
                                    </div>
                                </form>
                            </div>                       
                        </th>
                        <th></th>
                        <th></th>
                        <th>
                            <div class="box-tools">
                                <form class="form-horizontal">
                                    <div class="input-group input-group-sm" style="width: 130px;">
                                        @if(isset($status))
                                        <select name="status_search" class="form-control pull-right">
                                            @if($status === "")
                                                <option value="" selected="selected">选择</option>
                                                <option value="1">可用</option>
                                                <option value="0">废弃</option>
                                            @endif
                                            @if($status === '1')
                                                <option value="">选择</option>
                                                <option value="1" selected="selected">可用</option>
                                                <option value="0">废弃</option>
                                            @endif
                                            @if($status === '0')
                                                <option value="">选择</option>
                                                <option value="1">可用</option>
                                                <option value="0" selected="selected">废弃</option>
                                            @endif
                                        </select>
                                        @else
                                        <select name="status_search" class="form-control pull-right">
                                            <option value="" selected="selected">选择</option>
                                            <option value="1">可用</option>
                                            <option value="0">废弃</option>
                                        </select>
                                        @endif
                                        <div class="input-group-btn">
                                            <button type="button" class="filter btn btn-primary" data-url="{{ url('admin/spa/lst') }}" data-type="get" style="margin-right: 10px" onclick="getfun(this)"><i class="fa fa-search"></i></button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </th>
                        <th></th>
                    </tr>
                    @foreach($spa as $v)
                    <tr>
                        <td>{{$v->id}}</td>
                        <td>{{$v->pro_name}}</td>
                        <td>{{$v->good_sku}}</td>
                        <td>
                            <img src="{{ explode(';',$v->original_imgs)[0] }}" alt="" height="30" width="30">
                        </td>
                        <td>{{$v->country}}</td>
                        <td>
                        @if($v->url)
                            @if($v->country == 'TH')
                            <a target="_blank" href = "{{env('SPA_TH_URL').$v->url}}">{{env('SPA_TH_URL').$v->url}}</a>
                            @elseif($v->country == 'SA')
                            <a target="_blank" href = "{{env('SPA_SA_URL').$v->url}}">{{env('SPA_SA_URL').$v->url}}</a>
                            @endif
                        @endif
                        </td>
                        <td>{{$v->created_at}}</td>
                        <td>
                        @if($v->status == 1)
                        <span class="label label-success">可用</span>
                        @else
                        <span class="label label-danger">废弃</span>
                        @endif
                        </td>
                        <td>
                            <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/spa/'.$v->id.'/edit') }}" onclick="jumpfun(this)" class="btn btn-xs text-success "><i class="fa fa-edit"></i> 编辑</a>              
                            <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/spa/'.$v->id.'/clearcache') }}" onclick="delfun(this)" class="btn btn-xs text-warning "><i class="fa fa-trash-o"></i> 清除缓存</a>              
                            <!-- <a style="margin:3px;" href="javascript:void(0)" data-url="{{ url('/admin/spa/', $v->id) }}" onclick="delfun(this)" class="X-Small btn-xs text-danger "><i class="fa fa-edit"></i> 删除</a> -->                          
                        </td>
                    </tr>
                    @endforeach
                </table>
            </div>
            <div class="box-footer clearfix">
                <ul class="pagination pagination-sm no-margin pull-right">
                    {!! $spa->links('vendor.pagination.pages') !!}
                </ul>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->
    </div>
</div>
